﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="RepeaterExtensions.aspx.cs" Inherits="OpenWaves.Web.Showcase.RepeaterExtensions" %>

<!DOCTYPE html>

<html>
<head id="Head1" runat="server">
    <title></title>
</head>
<body>
    <form id="form1" runat="server">
        <div>    
            <h2>Empty data source</h2>
            <ow:Repeater runat="server" DataSource="<%#Enumerable.Empty<int>()%>">
                <NoResultsTemplate>
                    No results (empty) at: <%# DateTime.Now %> (expecting the current date)
                </NoResultsTemplate>
            </ow:Repeater>
        </div>

        <div>    
            <h2>Null data source</h2>
            <ow:Repeater runat="server" DataSource="<%# null%>">
                <NoResultsTemplate>
                    No results (null) at: <%# DateTime.Now %> (expecting the current date)
                </NoResultsTemplate>
            </ow:Repeater>
        </div>
    
        <div>
            <h2>Repeater template</h2>
            <ow:Repeater ID="Repeater1" runat="server" DataSource="<%#Enumerable.Range(1, 5)%>">
                <Template>
                    Items:
                    <%#((IEnumerable<int>) Repeater1.DataSource).Count()%>
                    <ul>
                        <ow:ItemsPlaceHolder runat="server" />
                    </ul>
                </Template>
                <ItemTemplate>
                    <li><%#Container.DataItem %></li>
                </ItemTemplate>
            </ow:Repeater>
        </div>
    
        <div>
            <h2>Alternating rows</h2>
            <ow:Repeater runat="server" DataSource="<%#new List<int> {1, 2, 3, 4, 5}%>">
                <Template>
                    <ul><ow:ItemsPlaceHolder runat="server"/></ul>
                </Template>
                <ItemTemplate>
                    <%#Container.Cycle("odd ", "even ") + Container.DataItem %>
                </ItemTemplate>
            </ow:Repeater>
        </div>    
    
        <div>
            <h2>First item template with separator template</h2>
            <ow:Repeater runat="server" DataSource="<%#new List<int> {1, 2, 3, 4, 5}%>">
                <FirstItemTemplate>
                    First <%#Container.DataItem %>
                </FirstItemTemplate>
                <ItemTemplate>
                    <%#Container.DataItem %>
                </ItemTemplate>
                <SeparatorTemplate>
                    ,
                </SeparatorTemplate>
            </ow:Repeater>
        </div>    


        <div>
            <h2>Groups with first item and separators</h2>
            <ow:Repeater runat="server" DataSource="<%#new List<int> {1, 2, 3, 4, 5}%>" GroupSize="2">
                <FirstItemTemplate>
                    First <%#Container.DataItem %>
                </FirstItemTemplate>
                <ItemTemplate>
                    <%#Container.Cycle("odd ", "even ") + Container.DataItem %>
                </ItemTemplate>
                <SeparatorTemplate>
                    ,
                </SeparatorTemplate>
	            <GroupTemplate>
		            <span style="border: 1px solid red"><ow:ItemsPlaceHolder runat="server" /></span>
	            </GroupTemplate>
            </ow:Repeater>
        </div>     
    
    </form>
</body>
</html>
